home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / vidhrdw / pcktgal.c < prev    next >
C/C++ Source or Header  |  2000-04-08  |  2KB  |  78 lines

  1. #include "driver.h"
  2. #include "vidhrdw/generic.h"
  3.  
  4. static int flipscreen;
  5.  
  6. WRITE_HANDLER( pcktgal_flipscreen_w )
  7. {
  8.     static int last_flip;
  9.     flipscreen = (data&0x80) ? 1 : 0;
  10.     if (last_flip!=flipscreen)
  11.         memset(dirtybuffer,1,0x800);
  12.     last_flip=flipscreen;
  13. }
  14.  
  15. void pcktgal_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh)
  16. {
  17.     int offs;
  18.  
  19.     /* Draw character tiles */
  20.     for (offs = videoram_size - 2;offs >= 0;offs -= 2)
  21.     {
  22.         if (dirtybuffer[offs] || dirtybuffer[offs+1])
  23.         {
  24.             int sx,sy,fx=0,fy=0;
  25.  
  26.             dirtybuffer[offs] = dirtybuffer[offs+1] = 0;
  27.  
  28.             sx = (offs/2) % 32;
  29.             sy = (offs/2) / 32;
  30.             if (flipscreen) {
  31.                 sx=31-sx;
  32.                 sy=31-sy;
  33.                 fx=1;
  34.                 fy=1;
  35.             }
  36.  
  37.             drawgfx(tmpbitmap,Machine->gfx[0],
  38.                     videoram[offs+1] + ((videoram[offs] & 0x0f) << 8),
  39.                     videoram[offs] >> 4,
  40.                     fx,fy,
  41.                     8*sx,8*sy,
  42.                     &Machine->drv->visible_area,TRANSPARENCY_NONE,0);
  43.         }
  44.     }
  45.  
  46.     /* copy the character mapped graphics */
  47.     copybitmap(bitmap,tmpbitmap,0,0,0,0,&Machine->drv->visible_area,TRANSPARENCY_NONE,0);
  48.  
  49.     /* Sprites */
  50.     for (offs = 0;offs < spriteram_size;offs += 4)
  51.     {
  52.         if (spriteram[offs] != 0xf8)
  53.         {
  54.             int sx,sy,flipx,flipy;
  55.  
  56.  
  57.             sx = 240 - spriteram[offs+2];
  58.             sy = 240 - spriteram[offs];
  59.  
  60.             flipx = spriteram[offs+1] & 0x04;
  61.             flipy = spriteram[offs+1] & 0x02;
  62.             if (flipscreen) {
  63.                 sx=240-sx;
  64.                 sy=240-sy;
  65.                 if (flipx) flipx=0; else flipx=1;
  66.                 if (flipy) flipy=0; else flipy=1;
  67.             }
  68.  
  69.             drawgfx(bitmap,Machine->gfx[1],
  70.                     spriteram[offs+3] + ((spriteram[offs+1] & 1) << 8),
  71.                     (spriteram[offs+1] & 0x70) >> 4,
  72.                     flipx,flipy,
  73.                     sx,sy,
  74.                     &Machine->drv->visible_area,TRANSPARENCY_PEN,0);
  75.         }
  76.     }
  77. }
  78.